import request from '@/config/axios'

/** 代理商提交记录信息 */
export interface AgentRecord {
          id: number; // id
          userId?: number; // 用户Id
          level?: number; // 级别
          status?: string; // 状态
          voucherType?: string; // 凭证类型
          voucher?: string; // 凭证
  }

// 代理商提交记录 API
export const AgentRecordApi = {
  // 查询代理商提交记录分页
  getAgentRecordPage: async (params: any) => {
    return await request.get({ url: `/member/agent-record/page`, params })
  },

  // 查询代理商提交记录详情
  getAgentRecord: async (id: number) => {
    return await request.get({ url: `/member/agent-record/get?id=` + id })
  },

  // 新增代理商提交记录
  createAgentRecord: async (data: AgentRecord) => {
    return await request.post({ url: `/member/agent-record/create`, data })
  },

  // 修改代理商提交记录
  updateAgentRecord: async (data: AgentRecord) => {
    return await request.put({ url: `/member/agent-record/update`, data })
  },

  // 删除代理商提交记录
  deleteAgentRecord: async (id: number) => {
    return await request.delete({ url: `/member/agent-record/delete?id=` + id })
  },

  /** 批量删除代理商提交记录 */
  deleteAgentRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/member/agent-record/delete-list?ids=${ids.join(',')}` })
  },

  // 导出代理商提交记录 Excel
  exportAgentRecord: async (params) => {
    return await request.download({ url: `/member/agent-record/export-excel`, params })
  },

  updateAgentRecordStatus: async (id: number, status: number, remark?: string): Promise<void> => {
    return await request.put({
      url: `/member/agent-record/update-status?id=${id}&status=${status}&remark=${remark}`
    })
  }
}
